#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os
import multiprocessing

def foo(i):
    print("进程名: {}".format(multiprocessing.current_process().name))
    print('模块名称:', __name__)
    print('父进程 id:', os.getppid())  # 获取父进程id
    print('当前子进程 id:', os.getpid())  # 获取自己的进程id
    print('------------------------')


if __name__ == '__main__':
    for i in range(5):
        m = multiprocessing.Process(target=foo, args=(i, ))
        m.start()
